import request from '@/utils/request'
const moduleApi = '/operation'

// 商品列表
export function getProductListApi(params) {
  return request({
    url: moduleApi + `/mallProduct/list`,
    method: 'get',
    params
  })
}
// 上架、下架、编辑商品
export function updateProductApi(data) {
  return request({
    url: moduleApi + `/mallProduct`,
    method: 'put',
    data
  })
}
// 上下架商品
export function updateProductStatusApi(data) {
  return request({
    url: moduleApi + `/mallProduct/editStatus`,
    method: 'put',
    data
  })
}
// 删除商品
export function deleteProductApi(id) {
  return request({
    url: moduleApi + `/mallProduct/${id}`,
    method: 'delete'
  })
}
// 新增商品
export function addProductApi(data) {
  return request({
    url: moduleApi + `/mallProduct`,
    method: 'post',
    data
  })
}
// 商品详情
export function getProductDetailApi(id) {
  return request({
    url: moduleApi + `/mallProduct/${id}`,
    method: 'get'
  })
}

// ==================商城订单==============================
export function getProductOrderListApi(params) {
  return request({
    url: moduleApi + `/mallOrder`,
    method: 'get',
    params
  })
}
// 退款
export function refundProductApi(data) {
  return request({
    url: moduleApi + `/mallOrder/refund`,
    method: 'post',
    data
  })
}
// 录入快递单号
export function enteringLogisticsSnApi(data) {
  return request({
    url: moduleApi + `/mallOrder/enteringLogisticsSn`,
    method: 'post',
    data
  })
}

// 订单详情
export function getProductOrderDetailApi(id) {
  return request({
    url: moduleApi + `/mallOrder/${id}`,
    method: 'get'
  })
}
// 订单列表导出
export function exportProductOrderListApi(params) {
  return request({
    url: moduleApi + `/mallOrder/export`,
    method: 'get',
    params,
    responseType: 'blob'
  })
}

// =============================== 积分列表 ==================
// 积分列表
export function getPointListApi(params) {
  return request({
    url: moduleApi + `/clientIntegral`,
    method: 'get',
    params
  })
}
// 积分记录
export function getPointRecordListApi(params) {
  return request({
    url: moduleApi + `/clientIntegral/history`,
    method: 'get',
    params
  })
}
